home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / sampler4.arc / FINANCE.SAC < prev    next >
Encoding:
Text File  |  1985-08-30  |  15.4 KB  |  455 lines

  1. on echo
  2. !*******************************************************************!
  3. !                                                                   !
  4. !               SORITEC Sampler Financial Functions                 !
  5. !                            (Chapter 7)                            !
  6. !                                                                   !
  7. !*******************************************************************!
  8. !    
  9. !    SORITEC Sampler contains most of the common financial functions
  10. !    used in project evaluation and other economic analysis studies.
  11. !    These functions are:
  12. !    
  13. !              (1) Internal Rate of Return
  14. !              (2) Present Value
  15. !              (3) Loan Amortization
  16. !    
  17. !    Some examples used to demonstrate financial functions are drawn from
  18. !    M. Wohl and B.V. Martin, "Traffic Systems Analysis for Engineers
  19. !    and Planners".  New York: McGraw-Hill, 1967, p. 215.  As the 
  20. !    examples are not specific to traffic engineering, they are used
  21. !    for benchmarking only.
  22. !    
  23. !*******************************************************************!
  24. !                                                                   !
  25. !                        Loan Amortization                          !
  26. !                         (Section 7.3)                             !
  27. !                                                                   !
  28. !*******************************************************************!
  29. !    
  30. !    To demonstrate the various features of the AMORT command, assume
  31. !    a loan for $100.00 issued for 5 years.  Repayment is assumed to
  32. !    occur at the end of each period so that if the loan is made at
  33. !    t=1, repayment occurs at the end of t=1,2,3,4,5.  Interest on the
  34. !    loan is 6 percent, expressed at an annual rate.
  35. !    
  36. !    The AMORT command can be used to calculate annual payments under
  37. !    different payback assumptions.  For example, if equal or uniform
  38. !    payments are made over the 5 year period, or if annual payments
  39. !    cover interest charges only with a balloon payment at the end of
  40. !    the loan, annual payments can be calculated easily.
  41. !    
  42. !    Let's set up the problem by defining the value of the loan, the
  43. !    interest rate and the loan period. 
  44. !    
  45.  
  46. SET loan = 100
  47. SET rate = .06
  48. USE 1 5
  49.  
  50. !    
  51. !    Annual payments associated with equal or uniform repayments over
  52. !    the five-year loan period are calculated using the command:
  53. !    
  54.  
  55. AMORT payment loan rate
  56.  
  57. !    
  58. !    The resulting "payment" is returned as a CONSTANT.  You may want to
  59. !    store these data as a time-series of payments for further analysis.
  60. !    Well, we do, anyway, and it is done with a simple assignment statment.
  61. !    We'll call the time-series "pay_stream_1'.
  62. !    
  63.  
  64. pay_stream_1 = payment
  65. PRINT pay_stream_1
  66.  
  67. !    
  68. !    If you want to calculate annual payments using the "Rule of 78",
  69. !    the command is:
  70. !    
  71.  
  72. AMORT(RULEOF78) payment 100 .06
  73.  
  74. !    
  75. !    If annual payments consist of only interest with repayment of the
  76. !    principal in the last period, they are estimated by including the
  77. !    BALLOON parameter in the command line, e.g.,
  78. !    
  79.  
  80. AMORT(BALLOON=100) payment loan rate
  81.  
  82. !    
  83. !    We'll save the payments as a time-series in the variable "pay_stream_2"
  84. !    for future use.
  85. !    
  86.  
  87. pay_stream_2 = payment
  88.  
  89. !    
  90. !    Note that we must add the balloon payment in the final year of the loan
  91. !    to derive the correct payment stream.
  92. !
  93.  
  94. USE 5
  95. REVISE pay_stream_2 = pay_stream_2 + 100
  96. USE 1 5
  97. PRINT pay_stream_2
  98.  
  99. !    
  100. !    If a loan is scheduled with irregular payments during the life of the 
  101. !    loan, auxilliary payments time-series can be specified in the command
  102. !    line.  The auxilliary payments differ from balloon payments in that
  103. !    payments to principal are assumed to occur at the same time regular
  104. !    payments are made.  Thus, periodic payments associated with a balloon
  105. !    payment of x at the end of a loan will not be the same as those
  106. !    associated with an auxilliary payment schedule with a lump sum payment
  107. !    of x in the last payment period.  This is best illustrated in an
  108. !    example.
  109. !    
  110. !    For the $100 loan at 6% interest, create an auxilliary time-series 
  111. !    containing a lump sum payment in year 5, e.g.,
  112. !    
  113.  
  114. balloon_payment_series = 0
  115. USE 5 5
  116. REVISE balloon_payment_series = 100
  117. USE 1 5
  118. PRINT balloon_payment_series
  119.  
  120. !    
  121. !    Now calculate annual payments with the AMORT command.  This time, we
  122. !    do not enter the "BALLOON=" parameter but instead include the 
  123. !    "balloon_payment_series" as the last argument in the command line.
  124. !    
  125.  
  126. AMORT payment loan rate balloon_payment_series
  127.  
  128. !    
  129. !    Note the difference between this amortization schedule and the one with
  130. !    the $100 balloon payment.  Although inappropriate for estimating
  131. !    repayment schedule for typical balloon payment loans, this option is 
  132. !    particularly useful for loans requiring periodic lump sum payments.  
  133. !    For example, if half the principal is due at the end of year 2 and half 
  134. !    in year 5, the command sequence to calculate annual payments is:
  135. !    
  136.  
  137. balloon_payment_series = 0
  138. USE 2
  139. REVISE balloon_payment_series = 50
  140. USE 5
  141. REVISE balloon_payment_series = 50
  142. USE 1 5
  143. PRINT balloon_payment_series
  144. AMORT payment loan rate balloon_payment_series
  145.  
  146. !    
  147. !    If the interest associated with a loan or investment is quoted in a 
  148. !    periodicity other than payment schedule, the AMORT command will convert
  149. !    the periodicity of the interest rate to that of the current USE period.
  150. !    Either SIMPLE or COMPOUND conversion is permitted.  These latter keywords
  151. !    are only relevant when periodicity conversion is specified.  
  152. !    
  153. !    To illustrate this option consider a one-year CD for $1000 with an 
  154. !    effective yield of 10.5% compounded daily purchased, say, in January
  155. !    of this year.  Interest payments on the CD are calculated monthly.  
  156. !    We can calculate the monthly yield with the following set of commands.
  157. !    
  158. !    Set up the parameters for the problem.
  159. !    
  160.  
  161. SET daily_interest = .105/365
  162. SET CD_amount = 1000
  163. USE 1985m1 1985m12
  164. AMORT(PERIOD=D,COMPOUND,BALLOON=1000) monthly_yield CD_amount daily_interest
  165. PRINT monthly_yield
  166.  
  167. !    
  168. !    The total you get from your investment can then be calculated directly.
  169. !    
  170.  
  171. SET total_yield = CD_amount + monthly_yield * 12
  172. PRINT total_yield
  173.  
  174. !*******************************************************************!
  175. !                                                                   !
  176. !                         Present Value                             !
  177. !                         (Section 7.2)                             !
  178. !                                                                   !
  179. !*******************************************************************!
  180. !    
  181. !    The PV command calculates the new present value of a stream of
  182. !    net benefits or costs associated with a financial venture given
  183. !    an interest rate or time-series of interest rates.  Optional
  184. !    modifiers in the command line allow you to convert the periodicity
  185. !    of the interest rate to conform to the net income stream and
  186. !    to change interest calculation from the default, COMPOUND, to
  187. !    SIMPLE.  The "net income stream" may also be specified as two
  188. !    time-series, "benefits" and "costs" - SORITEC Sampler will calculate
  189. !    the difference for you.
  190. !    
  191. !    Let's take a look at the Present Value estimates associated with
  192. !    the payment streams of some of the loans we analyzed in the previous
  193. !    section.
  194. !    
  195. !    This is also a good check of the consistency between the AMORT and
  196. !    PV commands since normally, the present value of the loan at the end of 
  197. !    the period should equal the amount of the loan.  Calculate
  198. !    the present value of the loan with uniform payments with the command:
  199. !    
  200. USE 1 5
  201.  
  202. PV present_value_1 pay_stream_1 rate
  203.  
  204. !    
  205. !    Note that the amount of the loan is less than the present value.  Upon
  206. !    inspection, the relation between the two variables is:
  207. !    
  208. !              present_value_1/(1 + rate) = loan
  209. !    
  210. !    The reason for this is that the AMORT command assumes the loan is
  211. !    dispensed at the beginning of period t=1 and repayments are made
  212. !    at the end of periods t=1,2,...,n.  This makes SORITEC Sampler's
  213. !    amortization estimates consistent with most amortization tables.
  214. !    The PV command, on the other hand, assumes the loan is dispensed in
  215. !    period t=0 and repayments are made at the beginning of periods
  216. !    t=1,2,...,n.  To make the estimates consistent, simply divide the
  217. !    present value estimate by (1 + rate), e.g.,
  218. !    
  219.  
  220. present_value_1 = present_value_1/(1 + rate)
  221. PRINT present_value_1
  222.  
  223. !    
  224. !    A similar result is obtained from the payment stream associated with
  225. !    the balloon payment amortization schedule, i.e.,
  226. !    
  227.  
  228. PV present_value_2 pay_stream_2 rate
  229. present_value_2 = present_value_2/(1 + rate)
  230. PRINT present_value_2
  231.  
  232. !    
  233. !    Let's now calculate, for each loan schedule, the present values of
  234. !    the ith-year payments on the $100 loan.  While we're at it, let's
  235. !    calculate the interest and principal owed at the end of each period.
  236. !    
  237. !    We can do this in a DOT-loop with a nested DO-loop.
  238. !    Some preliminary variable assignments and format statement
  239. !    specifications are required.
  240. !    
  241.  
  242. SET indicator = 0
  243. 200 format(///7x,'Repayment Schedule for a 5-year Loan of $100 at 6% Interest')
  244. 201 format(21x,'Uniform Payments over 5 Years'/)
  245. 202 format(7x,'Annual Interest Payments Plus Principal at End of 5th Year'/)
  246. 203 format(3x,'  Interest owed at Principal owed at')
  247. 204 format('     end of kth year   end of kth year   Total payment at', &
  248.    ' Present value of')
  249. 205 format(' k (prior to payment) (prior to payment)',2x, &
  250.            'end of kth year kth year payment')
  251. 206 format(' - ------------------ ------------------',2x, &
  252.            '--------------- ----------------')
  253. 207 format(f3.0,5x,f6.2,12x,f6.2,13x,f6.2,10x,f6.2)
  254. USE 1 5
  255. fill k 1 2 3 4 5
  256.  
  257. DOT pay_stream_1 pay_stream_2
  258.  
  259. SET indicator = indicator + 1
  260.  
  261. !    
  262. !    Initialize the time-series in which we will store the results.  These
  263. !    are a series of present values, an interest paid series and a series
  264. !    comprising the remaining principal on the loan.
  265. !    
  266.  
  267. USE 1 5
  268. pres_val_series = 0
  269. interest_series = 0
  270. principal_series = 0
  271.  
  272. !    
  273. !    Initialize other constants that will be used in calculations.
  274. !    
  275.  
  276. SET principal = loan
  277. SET sum_present_value = 0
  278. DO i = 1 TO 5
  279.  
  280. !    
  281. !    Calculate the interest on the principal remaining in the time period.
  282. !    
  283.  
  284. SET interest = principal * rate
  285.  
  286. USE i i
  287.  
  288. !    
  289. !    Calculate the principal repaid with the total payment, which is the
  290. !    difference between the total payment paid in the period and the
  291. !    interest paid in the period.
  292. !    
  293.  
  294. SET payment = :
  295.  
  296. SET principal_paid = payment - interest
  297.  
  298. !    
  299. !    Assign the principal remaining in the current period to the
  300. !    appropriate element in a time-series of remaining principal at t.
  301. !    
  302.  
  303. REVISE principal_series = principal
  304.  
  305. !    
  306. !    Calculate the remaining principal on the loan at the start of the 
  307. !    next period (equal to the remaining principal at t minus principal
  308. !    paid during t).
  309. !    
  310.  
  311. SET principal = principal - principal_paid
  312.  
  313. !    
  314. !    Now estimate the present value of payment stream.
  315. !    
  316. !    
  317. !    First, set the time period.
  318. !    
  319.  
  320. USE 1 i
  321.  
  322.  
  323. PV present_value : rate
  324. SET present_value = (present_value/(1+rate)) - sum_present_value
  325. SET sum_present_value = sum_present_value + present_value
  326.  
  327. !    
  328. !    Assign the present value, interest and principal estimates to the 
  329. !    appropriate element of the "pres_val_series", "interest_series" and
  330. !    "principal_series" time-series.
  331. !    
  332.  
  333. USE i i
  334. REVISE pres_val_series = present_value
  335.  
  336. REVISE interest_series = interest
  337.  
  338. !    
  339. !    That's it for the DO-loop.  Wait while Sampler grinds through the
  340. !    loop.  Each time it executes the PV command, Sampler will print out
  341. !    the unadjusted present value estimates (before dividing by 1+rate).
  342. !    
  343.  
  344. END
  345.  
  346. !    
  347. !    Print out the resulting series
  348. !    
  349.  
  350. USE 1 5
  351. !    
  352. !    Write out the series in a table.
  353. !    
  354.  
  355. OFF ECHO
  356. WRITE(200)
  357. IF indicator > 1; THEN; WRITE(202); ELSE ; WRITE(201)
  358. WRITE(203)
  359. WRITE(204)
  360. WRITE(205)
  361. WRITE(206)
  362. WRITE(207) (k interest_series principal_series : pres_val_series)
  363. ON ECHO
  364.  
  365. ENDDOT
  366.  
  367. !*******************************************************************!
  368. !                                                                   !
  369. !                    Internal Rate of Return                        !
  370. !                         (Section 7.1)                             !
  371. !                                                                   !
  372. !*******************************************************************!
  373. !    
  374. !    The internal rate of return of an investment is calculated by
  375. !    SORITEC Sampler with the IRR command.  IRR calculations use
  376. !    a discounted income stream procedure to calculate the rate of
  377. !    return.  Thus, the PV and IRR commands are consistent.  We
  378. !    illustrate the IRR command with an example comparison of two
  379. !    mutually exclusive project alternatives with the following
  380. !    characteristics:
  381. !    
  382. !                                Project A     Project B
  383. !    Project Service Life        10 years        30 years
  384. !    Capital Outlays in Year 0   $400,000      $1,000,000
  385. !    Annual Project Earnings      $56,951         $76,577
  386. !      over Service Life
  387. !   
  388. !    Initialize the data for each alternative and calculate
  389. !    the internal rate of return for each.
  390. !    
  391. !    Project A:
  392. !    
  393.  
  394. USE 1 10
  395. project_a_earnings = 56951
  396. project_a_capital_cost = 400000
  397.  
  398. IRR(CAPITAL=400000,TOLB=.0000001,MAXIT=50) rate_of_return_a project_a_earnings
  399.  
  400. !    
  401. !    To demonstrate the consistency between the IRR and PV commands,
  402. !    calculate the net present value of the project earnings stream
  403. !    using the rate of return estimated by the IRR command.
  404. !    
  405.  
  406. PV net_present_value project_a_earnings rate_of_return_a
  407.  
  408. !    
  409. !    Note that instead of using the CAPITAL modifier in the IRR command, 
  410. !    we could have subtracted the initial capital cost from the annual 
  411. !    earnings in the first period, i.e.,
  412.  
  413. USE 1 1
  414. REVISE project_a_earnings = project_a_earnings - project_a_capital_cost
  415. USE 1 10
  416. IRR rate_of_return_a project_a_earnings
  417.  
  418.  
  419. !    
  420. !    Project B:
  421. !    
  422.  
  423. USE 1 30
  424. project_b_earnings = 76577
  425. project_b_capital_cost = 1000000
  426.  
  427. IRR(CAPITAL=1000000,TOLB=.001,MAXIT=50) rate_of_return_b &
  428.                                                 project_b_earnings
  429.  
  430. !    
  431. !    Note that the project earnings does not have to be specified as
  432. !    as "net" in the IRR command line.  For example, we could define
  433. !    a cost stream for project B as a time series, e.g.,
  434. !    
  435.  
  436. project_b_costs = 0
  437. USE 1
  438. REVISE project_b_costs = 1000000
  439. USE 1 30
  440.  
  441. !    
  442. !    and then calculate the internal rate of return without the
  443. !    "CAPITAL=" modifier in the IRR command line.
  444. !    
  445.  
  446. IRR(TOLB=.001,MAXIT=50) rate_of_return_b &
  447.                             project_b_earnings project_b_costs
  448.  
  449. !    
  450. !    Obviously, this capability is meant for more complicated
  451. !    earnings and cost streams, but the example is illustrative.
  452. !    
  453. !    That's it for SORITEC Sampler's financial functions!
  454. QUIT
  455.